# FindSpiceClientGLib2.cmake

# SPICE_CLIENT_GLIB2_FOUND - System has SPICE_CLIENT_GLIB2
# SPICE_CLIENT_GLIB2_INCLUDES - The SPICE_CLIENT_GLIB2 include directories
# SPICE_CLIENT_GLIB2_LIBRARIES - The libraries needed to use SPICE_CLIENT_GLIB2
# SPICE_CLIENT_GLIB2_DEFINITIONS - Compiler switches required for using SPICE_CLIENT_GLIB2

find_package(PkgConfig)
pkg_check_modules(PC_SPICE_CLIENT_GLIB2 QUIET spice-client-glib-2.0)
set(SPICE_CLIENT_GLIB2_DEFINITIONS ${PC_SPICE_CLIENT_GLIB2_CFLAGS_OTHER})

find_path(SPICE_CLIENT_GLIB2_INCLUDE_DIR
          NAMES spice-client.h
          HINTS ${PC_SPICE_CLIENT_GLIB2_INCLUDEDIR} ${PC_SPICE_CLIENT_GLIB2_INCLUDE_DIRS}
          PATH_SUFFIXES spice-client-glib-2.0)

find_library(SPICE_CLIENT_GLIB2_LIBRARY
             NAMES spice-client-glib-2.0 libspice-client-glib-2.0
             HINTS ${PC_SPICE_CLIENT_GLIB2_LIBDIR} ${PC_SPICE_CLIENT_GLIB2_LIBRARY_DIRS})

set(SPICE_CLIENT_GLIB2_LIBRARIES ${SPICE_CLIENT_GLIB2_LIBRARY})
set(SPICE_CLIENT_GLIB2_INCLUDE_DIRS ${SPICE_CLIENT_GLIB2_INCLUDE_DIR})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SPICE_CLIENT_GLIB2 DEFAULT_MSG
                                  SPICE_CLIENT_GLIB2_LIBRARY
                                  SPICE_CLIENT_GLIB2_INCLUDE_DIR)

mark_as_advanced(SPICE_CLIENT_GLIB2_INCLUDE_DIR SPICE_CLIENT_GLIB2_LIBRARY)
